<%--
  Created by IntelliJ IDEA.
  User: 28912
  Date: 2022/11/6
  Time: 10:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" type="text/css" href="../../../web_01-1.0-SNAPSHOT/static/css/web_01.css"/>
    <meta charset="UTF-8">
    <title>stelog</title>
</head>
<body>
<div class="login_banner">
    <div id="l_content">
        <span class="login_word">学生信息管理系统</span>
    </div>
    <div id="content">
        <div class="login_form">
            <div class="login_box">
                <div class="tit">
                    <h1><span id="error"></span></h1>
                    <a href="../../../web_01-1.0-SNAPSHOT/sulog.jsp">学生登录</a>
                </div>
                <div class="msg_cont">
                    <b></b>
                    <span class="errorMsg" id="error01">请输入账号和密码</span>
                </div>
                <br />
                <div class="form">
                        <form method="post">
                        管理员账号：
                        <label>
                            <input  id="u_id" class="itxt" type="text" placeholder="请输入账号" />
                        </label>
                        <br />
                        <br />
                        管理员密码：
                        <label>
                            <input  id="u_pwd" class="itxt" type="password" placeholder="请输入密码" />
                        </label>
                        <br />
                        <br />
                        <button id="sub_btn">登录</button>
                        <span id="error03">${error}</span>
                        </form>
                    <script language="JavaScript">
                        let but01 = document.getElementById("sub_btn");
                        but01.onclick = function (){
                            let gid = document.getElementById("u_id").value;
                            let patt = /^\w{5,12}$/;
                            if(gid==null||gid===""){
                                document.getElementById("error01").innerHTML = "账号不能为空！"
                                return false;
                            }
                            let gpwd = document.getElementById("u_pwd").value;
                            if(gpwd==null||gpwd===""){
                                document.getElementById("error01").innerHTML = "密码不能为空!"
                                return false;
                            }else if(!patt.test(gpwd)){
                                document.getElementById("error01").innerHTML = "密码必须由字母数字下划线组成且长度在5到12位！"
                                return false;
                            }
                            //超链接访问servlet并带参数   注意返回值参数的类型！！！
                            window.location.href = "/web/login?id="+gid+"&pwd="+gpwd;
                            return false;
                        }
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
